using UnityEngine;
using System.Collections;

public class Bullet : MonoBehaviour {
    private float range = 20;
    private Vector3 start;

	public Bullet(int range){
        this.range = range;
    }

    public Bullet()
    {
    }


	void Start () {
        start = gameObject.transform.position;
	}
	
	void Update () {
        
        if (Vector3.Distance(start, gameObject.transform.position) < range)
        {
            gameObject.transform.position += gameObject.transform.forward;
        }
        else
        {
            Destroy(gameObject);
        }

	}

    public void SetTarget(Vector3 target)
    {
        gameObject.transform.LookAt(target);
    }
}
